package com.example.moilapp;

import com.example.moilapp.global.Moil_Array_To_List;
import com.example.moilapp.service.Moil_DO_Service;
import com.example.moilapp.service.Moil_Image_Load_Service;
import com.example.moilapp.service.Moil_Image_Save_Service;
import com.example.moilapp.service.Moil_Status_Service;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.Toast;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ListView;
import android.widget.TextView;

public class Moil_DO extends Activity {

	String[] values = new String[] { "JOB NO: 5351 DO Number 01 - 523234234",
			"JOB NO: 5351 DO Number 02 - 523225467",
			"JOB NO: 5351 DO Number 03 - 454555357",
			"JOB NO: 5351 DO Number 04 - 523456734" };

	//private ArrayAdapter<String> listAdapter;

	public static final String PREFS_NAME = "PrefsFile";

	TextView txt_pickup_data;
	TextView txt_Delivery_data;

	String pass_title_here;
	
	String pass_vassel;
	String[] pass_jobids;
	
	String[] pass_address;
	
	String picno;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.moil_do);

		Bundle extras = getIntent().getExtras();
		if (extras != null) {
			String pass_date = extras.getString("pass_date");
			String pass_title = extras.getString("pass_title");
			pass_vassel = extras.getString("pass_vassel");
			picno = extras.getString("pic");
			
			pass_title_here = pass_title;

			String pass_pickup_addr = extras.getString("pass_pickup_addr");
			String pass_delivery_addr = extras.getString("pass_delivery_addr");
			String address_list = extras.getString("address_list");

			String jobidstr = extras.getString("job_id");

			pass_jobids = jobidstr.split(",");

			pass_address = address_list.split("~");
			
		

			Button txt_title = (Button) findViewById(R.id.btn_title_label);
			TextView txt_vassel = (TextView) findViewById(R.id.txt_vassel_data);

			txt_title.setText(pass_date + " - " + pass_title);
			txt_vassel.setText(pass_vassel);

			//txt_pickup_data = (TextView) findViewById(R.id.txt_pickup_data);
			//txt_Delivery_data = (TextView) findViewById(R.id.txt_Delivery_data);

			//txt_pickup_data.setText(pass_pickup_addr);
			//txt_Delivery_data.setText(pass_delivery_addr);
			
			Button btnlogoout = (Button) findViewById(R.id.btn_logout);
			btnlogoout.setOnClickListener(new OnClickListener() {
				
				@Override
				public void onClick(View v) {
					onBackPressed();
					
				}
			});

		}


		Moil_Array_To_List.reSet();

		Moil_DO_Service mps = new Moil_DO_Service(Moil_DO.this, pass_vassel,
				pass_jobids,pass_address, pass_jobids.length - 1,
				((pass_jobids.length - 1) == 0) ? true : false,pass_title_here,picno);
		mps.execute(new String[] { "http://t2a1.cloudapp.net/TrafficWorkflow/TraficWorkflowWebService.asmx" });

	}

	@Override
	protected void onStop() {
		super.onStop();

	}

}
